C------------------------------------------------------------------
      SUBROUTINE BREAKU( STRING, MAXFLD, NFIELD, FIELD )
C     BREAK THE STRING UN INTO ITS FIELDS (FIELDS ARE SPERATED 
C        BY BLANKS OR TABS).
      IMPLICIT NONE
      CHARACTER*(*) FIELD(MAXFLD), STRING
      INTEGER MAXFLD, NFIELD
      INTEGER I, L, LEN, J, I1
      LOGICAL QUOTE
C
      L = LEN(STRING)
      NFIELD = 0
      I = 0
C
 2000 I = I + 1
      IF( I .LE. L ) THEN
         IF( STRING(I:I) .GT. ' ' ) THEN
C           FOUND BEGINNING OF THE FIELD.
            IF( STRING(I:I) .EQ. '"' .OR. STRING(I:I) .EQ. '''' ) THEN
               QUOTE = .TRUE.
               I = I + 1
            ELSE
               QUOTE = .FALSE.
            ENDIF
C           IF QUOTED STRING, SEARCH FOR MATCHING END QUOTE.
C           OTHERWISE SEARCH FOR A BLANK.
            DO 3000 J=I+1,L
               IF( ( QUOTE .AND. STRING(J:J) .EQ. STRING(I-1:I-1) ) .OR.
     +             ( .NOT. QUOTE .AND. STRING(J:J) .LE. ' ' ) ) THEN
C                 FOUND END OF FIELD.
                  I1 = J - 1
                  GOTO 4000
               ENDIF
 3000       CONTINUE
            I1 = L
 4000       IF( NFIELD .LT. MAXFLD ) THEN
               NFIELD = NFIELD + 1
C               IF( QUOTE ) THEN
C                 RETURN QUOTES AS PART OF STRING
C                  FIELD(NFIELD) = STRING(I-1:I1+1)
C               ELSE
               FIELD(NFIELD) = STRING(I:I1)
C               ENDIF
            ENDIF
            IF( QUOTE ) THEN
               I1 = I1 + 1
            ENDIF
            I = I1 
         ENDIF
         GOTO 2000
      ENDIF
      DO 5000 I=NFIELD+1,MAXFLD
         FIELD(I) = ' '
 5000 CONTINUE
      RETURN
      END
